<template>
  <div class="myBox">
    <div class="L"><img :src="LoginAuth.avatar_cdn" /></div>
    <div class="C">
      <div class="tit" v-if="LoginAuth.nickname">{{ LoginAuth.nickname }}</div>
      <div class="tit" v-else>未设置昵称</div>
      <div class="sub">{{ LoginAuth.mobile_text }}</div>
    </div>
    <div class="R"><img src="/assets/images/go.png" /></div>
  </div>
  <div class="clear"></div>
  <div class="allkbox"></div>
  <div class="myboxcon" @click="onProfile">
    <p>基本资料</p>
    <img src="/assets/images/go.png" />
  </div>
  <div class="myboxcon" @click="onEmail" v-if="LoginAuth.auth == 0">
    <p>邮箱认证</p>
    <img src="/assets/images/go.png" />
  </div>
  <div class="myboxcon" @click="this.$router.push('/business/address/index')">
    <p>我的收货地址</p>
    <img src="/assets/images/go.png" />
  </div>
  <div class="myboxcon" @click="this.$router.push('/business/base/collection')">
    <p>我的收藏</p>
    <img src="/assets/images/go.png" />
  </div>
  <div class="myboxcon" @click="onOrder">
    <p>我的订单</p>
    <img src="/assets/images/go.png" />
  </div>
  <div class="myboxcon" @click="this.$router.push('/business/base/expend')">
    <p>消费记录</p>
    <img src="/assets/images/go.png" />
  </div>
  <div class="myboxcon" @click="this.$router.push('/business/base/recharge')">
    <p>充值记录</p>
    <img src="/assets/images/go.png" />
  </div>
  <div class="myboxcon" @click="onExit">
    <p>退出账号</p>
    <img src="/assets/images/go.png" />
  </div>

  <div class="clear"></div>
  <div class="h54"></div>
  <div class="clear"></div>

  <Tab />
</template>
<script>
import Tab from "@/components/common/Tab.vue";
import { showConfirmDialog, showNotify } from "vant";
export default {
  components: {
    Tab,
  },
  data() {
    return {
      LoginAuth: {},
    };
  },
  created() {
    this.LoginAuth = this.$cookies.get("LoginAuth")
      ? this.$cookies.get("LoginAuth")
      : {};
  },
  methods: {
    onProfile() {
      this.$router.push("/business/base/profile");
    },
    onEmail() {
      this.$router.push("/business/base/email");
    },
    onOrder() {
      this.$router.push("/order/order/index");
    },
    onExit() {
      showConfirmDialog({
        title: "退出账号",
        message: "确认退出该账号吗？",
      })
        .then(() => {
          showNotify({
            type: "success",
            message: "退出成功",
            duration: 1500,
          });
          this.$cookies.set("LoginAuth", "");
          this.$router.push("/business/base/login");
        })
        .catch(() => {
          console.log(0);
        });
    },
  },
};
</script>